﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyBanVeMayBay.Resources;

namespace QuanLyBanVeMayBay
{
    public partial class ThemSanBay : Form
    {
        public ThemSanBay()
        {
            InitializeComponent();
        }
        public delegate void tensanbay(string value);

        public tensanbay tensan; 

        private void labelX2_Click(object sender, EventArgs e)
        {

        }

        private void bt_thoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //thêm sân bay----------------------------------------------------
        private void bt_them_Click(object sender, EventArgs e)
        {
            if (tb_masanbay.Text == "" || tb_tensanbay.Text == "" || tb_diachi.Text == "")
            {
                MessageBox.Show("Chưa điền đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                try
                {

                    string sql = "insert into SANBAY values('" + tb_masanbay.Text + "',N'" + tb_tensanbay.Text + "',N'" + tb_diachi.Text + "')";
                    xulydulieu xuly = new xulydulieu();
                    xuly.nonquery(sql);
                    tensan(tb_tensanbay.Text);
                    this.Close();
                    
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Lỗi xử lý\n !" + ex.Message, "Lỗi Xử Lý");
                }

            }
        }

        private void ThemSanBay_Load(object sender, EventArgs e)
        {

        }
    }
}
